﻿using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _02创建图形
{
    public class EllipseExam
    {
        [CommandMethod("EllipseDemo")]
        public void EllipseDemo()
        {
            //声明图形数据库
            Database db = HostApplicationServices.WorkingDatabase;
            ////public Ellipse(Point3d center, Vector3d unitNormal, Vector3d majorAxis, double radiusRatio, double startAngle, double endAngle);
            //Ellipse e1 = new Ellipse(); new Vector3d(0, 0, 1);
            
            Ellipse e2 = new Ellipse(new Point3d(100, 100, 0), Vector3d.ZAxis, new Vector3d(100, 0, 0), 5, 0, 2*Math.PI);
            db.AddEnityToModelSpace( e2);
            //db.AddEllipseToModelSpace(new Point3d(100, 100, 0), 200, 50, 0);
            //db.AddEllipseToModelSpace(new Point3d(300, 100, 0), 100, 50, 45);
            //db.AddEllipseToModelSpace(new Point3d(50, 50, 0), new Point3d(200, 200, 0), 60);

            //db.AddEllipseToModelSpace(new Point3d(50, 50, 0), new Point3d(200, 50, 0), 60);
            //db.AddRectToModelSpace(new Point2d(100, 100), new Point2d(500, 500));
            //db.AddEllipseToModelSpace(new Point3d(100, 100, 0), new Point3d(500, 500, 0));


            //db.AddRectToModelSpace(new Point2d(100, 100), new Point2d(500, 400));
            //db.AddEllipseToModelSpace(new Point3d(100, 100, 0), new Point3d(500, 400, 0));

            //db.AddRectToModelSpace(new Point2d(100, 100), new Point2d(200, 400));
            //db.AddEllipseToModelSpace(new Point3d(100, 100, 0), new Point3d(200, 400, 0));
        }
    }
}
